package org.wmq.taskschedule.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.wmq.taskschedule.biz.model.DO.Task;
import org.wmq.taskschedule.mapper.TaskMapper;
import org.wmq.taskschedule.service.TaskService;

@Service
@Slf4j
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService {
    @Override
    public int getTaskStatus(Long id) {
        return this.lambdaQuery().eq(Task::getId, id).select(Task::getStatus).one().getStatus();
    }

    @Override
    public void setStatus(Long id, int status) {
        this.lambdaUpdate().eq(Task::getId, id).set(Task::getStatus, status).update();
    }
}
